Extract ContainerContext and add AccessibilityDescribable protocol#309
Draft
RoyalPineapple wants to merge 3 commits intoa11y-hierarchy-parsingfrom
Draft
Extract ContainerContext and add AccessibilityDescribable protocol#309RoyalPineapple wants to merge 3 commits intoa11y-hierarchy-parsingfrom
RoyalPineapple wants to merge 3 commits intoa11y-hierarchy-parsingfrom
Conversation
0526035 to
ffc8f11
Compare
352e05a to
f549237
Compare
ffc8f11 to
09f2ec8
Compare
f5e9f91 to
99cb260
Compare
d56de3a to
35c20f3
Compare
Introduces `parseAccessibilityHierarchy()` which returns accessibility data as a tree structure preserving container relationships, compared to the existing `parseAccessibilityElements()` which returns a flat list. New types: - `AccessibilityHierarchy`: Recursive enum with `.element` and `.container` cases - `AccessibilityContainer`: Container metadata (type, frame, traits) - `ContainerType`: Enum for semantic groups, lists, landmarks, data tables, tab bars All types conform to Codable for serialization. The hierarchy can be flattened back to elements via `flattenToElements()` for compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
9f68802 to
406089b
Compare
- Add AccessibilityDescribable protocol for unified VoiceOver description generation - Extract ContainerContext from internal parser type to public AccessibilityElement.ContainerContext - Add containerContext property to AccessibilityElement for storing parse-time context - Add voiceOverDescription computed property to regenerate descriptions from stored properties - Include high-importance custom content in accessibility descriptions (per WWDC21) - Rename UIAccessibility+SnapshotAdditions.swift to UIAccessibility+RotorAdditions.swift Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35c20f3 to
7e7f707
Compare
406089b to
9790120
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes accessibility descriptions regenerable from stored data by eliminating NSObject references from the container context.
Motivation
Previously,
AccessibilityHierarchyParser.Contextheld references to live UIKit objects (e.g.,UITabBarItem). This meant:Solution
1. Extract reference-free
ContainerContextThe new
AccessibilityElement.ContainerContextstores only primitive data:(index: Int, count: Int)instead of object referencesUITabBarItemreference[NSObject]2. Add
AccessibilityDescribableprotocolUnified description generation that works for both:
NSObject(live UIKit elements at parse time)AccessibilityElement(stored elements withcontainerContext)3. Enable dynamic description regeneration
AccessibilityElement.voiceOverDescriptioncan now recompute the description from stored properties, enabling future verbosity controls.Also included
AXCustomContentnow appears in descriptions (per WWDC21)UIAccessibility+SnapshotAdditions.swift→UIAccessibility+RotorAdditions.swiftTest plan
ContainerContextserializes to JSONvoiceOverDescriptionregenerates identical descriptions from stored data🤖 Generated with Claude Code